package com.jx.web;

import com.baomidou.mybatisplus.extension.api.R;
import com.jx.common.Result;
import com.jx.dto.FloorDto;
import com.jx.pojo.CarouselBanner;
import com.jx.pojo.Floor;
import com.jx.pojo.GuessLike;
import com.jx.service.HomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/home")
public class HomeController {
    @Autowired
    private HomeService homeService;

    /**
     * 获取轮播图数据
     * @return
     */
    @GetMapping("/getCarouselBanner")
    public Result<CarouselBanner> getCarouselBanner() {
        Result<CarouselBanner> res = new Result<>();
        List<CarouselBanner> carouselBanners = homeService.getCarouselBannerList();
        res.setCode(200);
        res.setMessage("成功");
        res.setData(carouselBanners);
        return res;
    }


    /**
     * 获取楼层模块floor数据
     * @return
     */
    @GetMapping("/getFloorList")
    public Result<FloorDto> getFloorList() {
        Result<FloorDto> res = new Result<>();
        List<FloorDto> floorDtoList = homeService.getFloorList();
        res.setCode(200);
        res.setMessage("成功");
        res.setData(floorDtoList);
        return res;
    }

    /**
     * 获取猜你喜欢guess_like数据
     */
    @GetMapping("/getGuessLikeList")
    public Result<GuessLike> getGuessLikeList() {
        Result<GuessLike> res = new Result<>();
        List<GuessLike> guessLikes = homeService.getGuessLikeList();
        res.setCode(200);
        res.setMessage("成功");
        res.setData(guessLikes);
        return res;
    }
}
